package com.hoshiicloud.commissioncalculation.feign.hystrix;

import com.hoshiicloud.commissioncalculation.feign.UserFeignService;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.saleorder.dto.PlatStoreDTO;
import com.hoshiicloud.user.entity.store.PlatStore;
import feign.hystrix.FallbackFactory;

import java.util.List;

/**
 * @author admin
 * @title: HystrixUserFeignFallback
 * @projectName hoshiicloud
 * @description: 用户熔断
 * @date 2019/9/6
 */
public class HystrixUserFeignFallback implements FallbackFactory<UserFeignService> {
    @Override
    public UserFeignService create(Throwable cause) {
        return new UserFeignService() {
            @Override
            public Response<PlatStoreDTO> queryById(Long id) {
                return Response.failed(cause.getMessage());
            }

            @Override
            public Response<List<Long>> updateBatchStores(List<PlatStore> platStoreList) {
                return Response.failed(cause.getMessage());
            }

        };
    }
}
